package io;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;

public class WriteStringDemo {
    public static void main(String[] args) throws IOException {
        FileOutputStream fos = new FileOutputStream("fos2.txt");
        String line = "1974年第一次在东南亚打自由搏击";
        //String直接提供了将内容转换为一组字节的方法
        byte[]data = line.getBytes(StandardCharsets.UTF_8);

        fos.write(data);
        System.out.println("写出完毕");
        fos.close();

    }
}
